home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 23 April 2001
- //
- // Procedure Name:
- // art3dPaintEffectsBrushCallback
- //
- // Description:
- // Callback that is called via a scriptJob whenever an important
- // attribute on the paint effects default brush is changed.
- //
- // Input Arguments:
- // $artCommand - command to change tool settings
- //
- // Return Value:
- // None.
- //
- global proc art3dPaintEffectsBrushCallback( string $artCommand )
- {
- // Set the paint effects brush mode.
- //
- string $currContext = `currentCtx`;
-
- if ( $currContext != "art3dPaintContext" ) return;
-
- // Read old values out of the context to see if we really need to update it
- //
- string $cmd = $artCommand + " -q -paintoperationtype " + $currContext;
- string $oldOp = eval( $cmd );
- $cmd = $artCommand + " -q -brushtype " + $currContext;
- string $oldBrushType = eval( $cmd );
- $cmd = $artCommand + " -q -pfxScale " + $currContext;
- float $oldScale = eval( $cmd );
- $cmd = $artCommand + " -q -pfxWidth " + $currContext;
- float $oldWidth = eval( $cmd );
-
- // If 3D paint is not in paint effects mode, then we don't need to update
- //
- if ( $oldBrushType != "effectsBrush" ) return;
-
- // Figure out the new values to set into the context
- //
- string $operation;
- float $scale, $width;
-
- // Set the paint mode based on the brush settings
- //
- string $defaultBrush = getDefaultBrush();
- int $mode = getAttr( $defaultBrush + ".brushType" );
- switch( $mode ) {
- case 0: // Paint
- case 4: // ThinLine
- case 5: // Mesh
- $operation = "Paint";
- break;
- case 1: // Smear
- $operation = "Smear";
- break;
- case 2: // Blur
- $operation = "Blur";
- break;
- }
-
- $scale = getAttr( $defaultBrush + ".globalScale" );
- $width = getAttr( $defaultBrush + ".brushWidth" );
-
- // Check to see if we need to update the context
- //
- if ( ( $oldOp == $operation ) &&
- ( abs( $oldScale - $scale ) < 0.0001 ) &&
- ( abs( $oldWidth - $width ) < 0.0001 ) )
- {
- // Everything's up to date
- //
- return;
- }
-
- // Build and execute the command to update the context
- //
- $cmd = $artCommand;
- $cmd += " -e -paintoperationtype \"" + $operation + "\" ";
- $cmd += " -e -pfxScale " + $scale + " ";
- $cmd += " -e -pfxWidth " + $width + " ";
- $cmd += $currContext;
-
- eval $cmd;
- }